<?php

/**
 * Class: Community_Form_time
 * @author ovo
 * This form enables the user submit a the time the specific course was taken before rating
 * it 
 */
class Community_Form_time extends Zend_Dojo_Form {
	
	public function __construct($options = null){	
 		
	parent::__construct($options);
	Zend_Dojo::enableForm($this);
	 
	$this->setName('When did you take this course');
	
	/*
	$course = new Zend_Dojo_Form_Element_FilteringSelect('course');
	$listcourses = new Admin_Model_DbTable_Courses();
	$list = $listcourses->fetchAll();
	
	foreach($list as $l)
	  $course->addMultiOption($l->id, $l->name);*/
	
	$fi = Zend_Controller_Front::getInstance();
	$val = $fi->getRequest()->getParam('id');
	$name = $fi->getRequest()->getParam('no');
	$dat = $fi->getRequest()->getParam('school');
	$dept = $fi->getRequest()->getParam('dept');
	$course = new Zend_Form_Element_Hidden('course');
	$sname = new Zend_Form_Element_Hidden('course_no');
	$school = new Zend_Form_Element_Hidden('school');
	$department = new Zend_Form_Element_Hidden('depts');
	
	$school->setValue($dat);
    $sname->setValue($name);
	$course->setValue($val);
	$department->setValue($dept);
	//semester
	$courseSemester = new Zend_Dojo_Form_Element_FilteringSelect('semester');
	$courseSemester->setLabel('Enter the Semester:');
	$courseSemester->setRequired(true);
	
	$options = array (
	  'fall' => 'fall',
	  'summer' => 'summer',
	  'spring' => 'spring'
	);
	
	$courseSemester->addMultiOptions($options);
	
	//year
	$courseYear = new Zend_Dojo_Form_Element_FilteringSelect('year');
	$courseYear->setLabel('Enter the course Year');
	$courseYear->setRequired(true);
	$Newoptions = array (
	  '2000' => '2000',
	  '2001' => '2001',
	  '2002' => '2002',
	  '2003' => '2003',
	  '2004' => '2004',
	  '2005' => '2005',
	  '2006' => '2006',
	  '2007' => '2007',
	  '2008' => '2008',
	  '2009' => '2009',
	  '2010' => '2010'
	  
	);
	
	
		$sname->removeDecorator('Label');
		$sname->addDecorator('Label');
		$sname->removeDecorator('HtmlTag');
		$sname->addDecorator('HtmlTag', array('tag' => 'p'));
		
		
$school->removeDecorator('Label');
$school->addDecorator('Label');
$school->removeDecorator('HtmlTag');
$school->addDecorator('HtmlTag', array('tag' => 'p'));

	$courseYear->addMultiOptions($Newoptions);
	$this->addElements(array($course,$sname,$school, $department,$courseSemester, $courseYear));	

	$submit = new Zend_Dojo_Form_Element_SubmitButton('submit');
	$this->setMethod('GET');
	$this->addElement($submit);
	 
	}
}